package com.hospicpc.demos.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hospicpc.demos.entity.Articles;
import com.hospicpc.demos.entity.UserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserInfoMapper extends BaseMapper<UserInfo> {

    @Select("select avatar_url from tb_userinfo where user_id = #{messageId}")
    String getUserAvatar(@Param("messageId") String messageId);
    @Select("select user_id from tb_userinfo where id = #{userId}")
    String selectUserIdById(@Param("userId") String userId);
    @Select("select user_id from tb_userinfo where id=#{userId}")
    String queryUserIdById(@Param("userId") String userId);
    @Select("select nick_name from tb_userinfo where user_id=#{userId}")
    String selectNickNameById(@Param("userId") String userId);
    @Select("select * from tb_userinfo where id in (select to_user_id from tb_follow_user where user_id = #{userId} and status = 1 order by id desc)")
    List<UserInfo> getFollowListByUserId(@Param("userId") Long userId);
}
